﻿using MetroEventToCommand;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238

namespace TestApp
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage
    {
        public Command Test1Command { get; set; }

        public Command<string> Test2Command { get; set; }

        public Command<EventParameter<string>> Test3Command { get; set; }

        public Command<EventParameter<int>> Test4Command { get; set; }

        public EventParameter<string> EventParam { get; set; }

        public string SimpleParam { get; set; }


        private Button _bb;

        public MainPage()
        {
            this.InitializeComponent();

            SimpleParam = "Hello";

            Test1Command = new Command(() => Test1PassedTB.Visibility = Visibility.Visible);

            Test2Command = new Command<string>((param) =>
                                                   {
                                                       if (param == "Hello")
                                                           Test2PassedTB.Visibility = Visibility.Visible;
                                                       else
                                                           Test2FailedTB.Visibility = Visibility.Visible;
                                                   });

            Test3Command = new Command<EventParameter<string>>((param) =>
            {
                if ((param.Sender is Button) && (param.Parameter == "Hello"))
                    Test3PassedTB.Visibility = Visibility.Visible;
                else
                {
                    Test3FailedTB.Visibility = Visibility.Visible;
                }
            });

            Test4Command = new Command<EventParameter<int>>((param) =>
            {
                if ((param.Sender is Button) && (param.Parameter == 111))
                    Test4PassedTB.Visibility = Visibility.Visible;
                else
                {
                    Test4PassedTB.Visibility = Visibility.Visible;
                }
            });

            DataContext = this;
        }
    }
}
